cmake_minimum_required(VERSION 3.16)
project(DPXDemo VERSION 1.0.0 DESCRIPTION "Demonstration of libDPX")

set(libdpx_DIR ${CMAKE_HOME_DIRECTORY}/../cmake)
find_package(libdpx REQUIRED)


add_executable(DemoAnalog src/dpxdemo_analog.c)
add_executable(DemoSimon src/dpxdemo_simon.c)
add_executable(DemoStrabismus src/dpxdemo_strabismus.c)
add_executable(DemoTest3D src/dpxdemo_test3d.c)
add_executable(DemoTrigger src/dpxdemo_trigger.c)

target_link_libraries(DemoAnalog libdpx::libdpx)
target_link_libraries(DemoSimon libdpx::libdpx)
target_link_libraries(DemoStrabismus libdpx::libdpx)
target_link_libraries(DemoTest3D libdpx::libdpx)
target_link_libraries(DemoTrigger libdpx::libdpx)

# This is just to copy the libdpx dll to the right place
# DemoAnalog should be run first
add_custom_command(TARGET DemoAnalog
    POST_BUILD
    WORKING_DIRECTORY $<TARGET_FILE_DIR:DemoAnalog>
    COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:libdpx::libdpx> .
    )
